package com.lemon;

import java.util.Date;

import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import com.lemon.utils.StringUtil;

@SpringBootApplication
@ServletComponentScan   //扫描Servlet  
@MapperScan(basePackages = { "com.lemon.mapper" }, sqlSessionFactoryRef = "mysqlSqlSessionFactory") // </span>//这里mapper是你的mybatis的mapper目录。
@EnableTransactionManagement
public class CityRunApplication extends SpringBootServletInitializer{
	
	@Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
		SpringApplicationBuilder sources = application.sources(CityRunApplication.class);
		//		new Server();//启动
		return sources;
	}
	
	public CityRunApplication() {
		super();
		setRegisterErrorPageFilter(false);
	}

	public static void main(String[] args) {
		Logger log = LoggerFactory.getLogger(CityRunApplication.class);
		
		System.out.println("start:" + StringUtil.DateToString(new Date(), 41));
		Date a = new Date();
		SpringApplication.run(CityRunApplication.class, args);
		
		Date b = new Date();
    	String ss = (b.getTime()-a.getTime()) +"";
    	StringBuffer sb = new StringBuffer();
    	int le =ss.length() ;
    	if(le>3){
    		le = ss.length()-3;
    		sb.append(ss).insert(le, ".").append(" seconds");
    	}else{
    		sb.append(ss).append(" ms");
    	}
		
		/////////////////////////////////////////////////////////////////
		
		System.err.println("||-------------------------------------Start Done!-------------------------------------");
		System.err.println("||    ______                   _____   ____  _   _ ______     _                       ______   ");
		System.err.println("||   / / / /                  |  __ \\ / __ \\| \\ | |  ____|   | |                      \\ \\ \\ \\  ");
		System.err.println("||  / / / /_____ ______ ______| |  | | |  | |  \\| | |__      | |   ____ __ ______ _____\\ \\ \\ \\ ");
		System.err.println("|| ( ( ( (______|______|______| |  | | | START. ` |  __|     | |  |______|______|______ ) ) ) )");
		System.err.println("||  \\ \\ \\ \\                   | |__| | |__| | |\\  | |____    |_|                       / / / / ");
		System.err.println("||   \\_\\_\\_\\                  |_____/ \\____/|_| \\_|______|   (_)                      /_/_/_/");
		System.err.println("||");
		System.err.println("||=============================== Start Done! [ "+sb.toString()+" ] =======================================");
		System.err.println("||");
		//new Server();//启动
		
		/////////////////////////////////////////////////////////////////
	}
	
}
